Imports System
Imports ValidationFramework


Public Class EnumConversionRuleAttributeExample

    Public Enum Numbers
        ' Fields
        One = 0
        Three = 2
        Two = 1
    End Enum

    ' Methods
    Public Sub ParseDecimal( _
    <EnumConversionRule("ExampleLibraryVB.EnumConversionRuleAttributeSample+Numbers, ExampleLibraryVB")> ByVal decimalString As String)
        ParameterValidationManager.ThrowException(Me, doSomethingHandle, decimalString)
    End Sub


    ' Properties
    <EnumConversionRule("ExampleLibraryVB.EnumConversionRuleAttributeSample+Numbers, ExampleLibraryVB", ErrorMessage:="Invalid decimal format.")> _
    Public Property DecimalString() As String
        Get
            Return _decimalString
        End Get
        Set(ByVal value As String)
            _decimalString = value
        End Set
    End Property


    ' Fields
    Private _decimalString As String
    Private Shared ReadOnly doSomethingHandle As RuntimeMethodHandle = _
    GetType(EnumConversionRuleAttributeExample).GetMethod("DoSomething").MethodHandle
End Class

